window.ZENG = window.ZENG || {};

ZENG.dom = {
	getById : function(b) {
		return document.getElementById(b)
	},
	get : function(b) {
		return (typeof (b) == "string") ? document.getElementById(b) : b
	},
	createElementIn : function(h, i, l, k) {
		var g = (i = ZENG.dom.get(i) || document.body).ownerDocument
				.createElement(h || "div"), j;
		if (typeof (k) == "object") {
			for (j in k) {
				if (j == "class") {
					g.className = k[j]
				} else {
					if (j == "style") {
						g.style.cssText = k[j]
					} else {
						g[j] = k[j]
					}
				}
			}
		}
		l ? i.insertBefore(g, i.firstChild) : i.appendChild(g);
		return g
	},
	getStyle : function(m, e) {
		m = ZENG.dom.get(m);
		if (!m || m.nodeType == 9) {
			return null
		}
		var k = document.defaultView && document.defaultView.getComputedStyle, l = !k ? null
				: document.defaultView.getComputedStyle(m, ""), i = "";
		switch (e) {
		case "float":
			e = k ? "cssFloat" : "styleFloat";
			break;
		case "opacity":
			if (!k) {
				var j = 100;
				try {
					j = m.filters["DXImageTransform.Microsoft.Alpha"].opacity
				} catch (n) {
					try {
						j = m.filters("alpha").opacity
					} catch (n) {
					}
				}
				return j / 100
			} else {
				return parseFloat((l || m.style)[e])
			}
			break;
		case "backgroundPositionX":
			if (k) {
				e = "backgroundPosition";
				return ((l || m.style)[e]).split(" ")[0]
			}
			break;
		case "backgroundPositionY":
			if (k) {
				e = "backgroundPosition";
				return ((l || m.style)[e]).split(" ")[1]
			}
			break
		}
		if (k) {
			return (l || m.style)[e]
		} else {
			return (m.currentStyle[e] || m.style[e])
		}
	},
	setStyle : function(r, o, l) {
		if (!(r = ZENG.dom.get(r)) || r.nodeType != 1) {
			return false
		}
		var q, k = true, p = (q = document.defaultView) && q.getComputedStyle, m = /z-?index|font-?weight|opacity|zoom|line-?height/i;
		if (typeof (o) == "string") {
			q = o;
			o = {};
			o[q] = l
		}
		for ( var n in o) {
			l = o[n];
			if (n == "float") {
				n = p ? "cssFloat" : "styleFloat"
			} else {
				if (n == "opacity") {
					if (!p) {
						n = "filter";
						l = l >= 1 ? "" : ("alpha(opacity="
								+ Math.round(l * 100) + ")")
					}
				} else {
					if (n == "backgroundPositionX"
							|| n == "backgroundPositionY") {
						q = n.slice(-1) == "X" ? "Y" : "X";
						if (p) {
							var j = ZENG.dom.getStyle(r, "backgroundPosition"
									+ q);
							n = "backgroundPosition";
							typeof (l) == "number" && (l = l + "px");
							l = q == "Y" ? (l + " " + (j || "top"))
									: ((j || "left") + " " + l)
						}
					}
				}
			}
			if (typeof r.style[n] != "undefined") {
				r.style[n] = l
						+ (typeof l === "number" && !m.test(n) ? "px" : "");
				k = k && true
			} else {
				k = k && false
			}
		}
		return k
	},
	getScrollTop : function(c) {
		var d = c || document;
		return Math.max(d.documentElement.scrollTop, d.body.scrollTop)
	},
	getClientHeight : function(c) {
		var d = c || document;
		return d.compatMode == "CSS1Compat" ? d.documentElement.clientHeight
				: d.body.clientHeight
	}
};
ZENG.string = {
	RegExps : {
		trim : /^\s+|\s+$/g,
		ltrim : /^\s+/,
		rtrim : /\s+$/,
		nl2br : /\n/g,
		s2nb : /[\x20]{2}/g,
		URIencode : /[\x09\x0A\x0D\x20\x21-\x29\x2B\x2C\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E]/g,
		escHTML : {
			re_amp : /&/g,
			re_lt : /</g,
			re_gt : />/g,
			re_apos : /\x27/g,
			re_quot : /\x22/g
		},
		escString : {
			bsls : /\\/g,
			sls : /\//g,
			nl : /\n/g,
			rt : /\r/g,
			tab : /\t/g
		},
		restXHTML : {
			re_amp : /&amp;/g,
			re_lt : /&lt;/g,
			re_gt : /&gt;/g,
			re_apos : /&(?:apos|#0?39);/g,
			re_quot : /&quot;/g
		},
		write : /\{(\d{1,2})(?:\:([xodQqb]))?\}/g,
		isURL : /^(?:ht|f)tp(?:s)?\:\/\/(?:[\w\-\.]+)\.\w+/i,
		cut : /[\x00-\xFF]/,
		getRealLen : {
			r0 : /[^\x00-\xFF]/g,
			r1 : /[\x00-\xFF]/g
		},
		format : /\{([\d\w\.]+)\}/g
	},
	commonReplace : function(e, f, d) {
		return e.replace(f, d)
	},
	format : function(e) {
		var d = Array.prototype.slice.call(arguments), f;
		e = String(d.shift());
		if (d.length == 1 && typeof (d[0]) == "object") {
			d = d[0]
		}
		ZENG.string.RegExps.format.lastIndex = 0;
		return e.replace(ZENG.string.RegExps.format, function(b, a) {
			f = ZENG.object.route(d, a);
			return f === undefined ? b : f
		})
	}
};
ZENG.object = {
	routeRE : /([\d\w_]+)/g,
	route : function(h, g) {
		h = h || {};
		g = String(g);
		var f = ZENG.object.routeRE, e;
		f.lastIndex = 0;
		while ((e = f.exec(g)) !== null) {
			h = h[e[0]];
			if (h === undefined || h === null) {
				break
			}
		}
		return h
	}
};
var ua = ZENG.userAgent = {}, agent = navigator.userAgent;
ua.ie = 9 - ((agent.indexOf("Trident/5.0") > -1) ? 0 : 1)
		- (window.XDomainRequest ? 0 : 1) - (window.XMLHttpRequest ? 0 : 1);
if (typeof (ZENG.msgbox) == "undefined") {
	ZENG.msgbox = {}
}
ZENG.msgbox._timer = null;
ZENG.msgbox.loadingAnimationPath = ZENG.msgbox.loadingAnimationPath
		|| ("loading.gif");
ZENG.msgbox.show = function(r, s, k, q) {
	if (typeof (q) == "number") {
		q = {
			topPosition : q
		}
	}
	q = q || {};
	var m = ZENG.msgbox, t = '<span class="zeng_msgbox_layer" style="display:none;z-index:10000;" id="mode_tips_v2"><span class="gtl_ico_{type}"></span>{loadIcon}{msgHtml}<span class="gtl_end"></span></span>', o = '<span class="gtl_ico_loading"></span>', p = [
			0, 0, 0, 0, "succ", "fail", "clear" ], l, n;
	m._loadCss && m._loadCss(q.cssPath);
	l = ZENG.dom.get("q_Msgbox")
			|| ZENG.dom.createElementIn("div", document.body, false, {
				className : "zeng_msgbox_layer_wrap"
			});
	l.id = "q_Msgbox";
	l.style.display = "";
	l.innerHTML = ZENG.string.format(t, {
		type : p[s] || "hits",
		msgHtml : r || "",
		loadIcon : s == 6 ? o : ""
	});
	 m._setPosition(l, k, q.topPosition)
};
ZENG.msgbox._setPosition = function(h, k, m) {
	k = k || 5000;
	var n = ZENG.msgbox, l = ZENG.dom.getScrollTop(), j = ZENG.dom
			.getClientHeight(), i = Math.floor(j / 2) - 40;
	ZENG.dom.setStyle(h, "top",
			((document.compatMode == "BackCompat" || ZENG.userAgent.ie < 7) ? l
					: 0)
					+ ((typeof (m) == "number") ? m : i) + "px");
	clearTimeout(n._timer);
	h.firstChild.style.display = "";
	k && (n._timer = setTimeout(n.hide, k))
};
ZENG.msgbox.hide = function(d) {

	var c = ZENG.msgbox;
	if (d) {
		clearTimeout(c._timer);
		c._timer = setTimeout(c._hide, d)
	} else {
		c._hide()
	}
};
ZENG.msgbox._hide = function() {
	var f = ZENG.dom.get("q_Msgbox"), e = ZENG.msgbox;
	clearTimeout(e._timer);
	if (f) {
		var d = f.firstChild;
		ZENG.dom.setStyle(f, "display", "none")
	}
};